<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>script标签在html中书写位置</title>
    <!-- 效果1 -->
    <!--
    <script>
        var id = document.getElementById("context")
        console.log(id)
    </script>
    -->
</head>

<body>
    <div id="context">你好</div>
    <!-- 效果2 -->
    <script>
        var id = document.getElementById("context")
        console.log(id)
    </script>
</body>

</html>